package com.efivestar.idm.api.config;

import com.efivestar.idm.api.util.tianyi.MobileServicesPortType;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TianyiWebServiceClient {

    @Value("${tianyi.webserviceUrl:http://www.189eyes.com:9000/cxf/MobileService}")
    private String tianyiWebserviceUrl;
    @Bean
    public MobileServicesPortType initMobileServicePortType(){
        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
        factory.setServiceClass(MobileServicesPortType.class);
        factory.setAddress(tianyiWebserviceUrl);
        MobileServicesPortType service = (MobileServicesPortType)factory.create();
        return service;
    }
}
